package org.example.day;

import java.util.HashMap;

/**
 * @Description: TODO
 * @Author wyatt
 * @Data 2024/08/21 17:36
 */
public class Solution2956 {

    public int[] findIntersectionValues(int[] nums1, int[] nums2) {
        HashMap<Integer, Integer> nums1Map = new HashMap<>();
        HashMap<Integer, Integer> nums2Map = new HashMap<>();
        for (int i : nums1) {
            nums1Map.putIfAbsent(i, 0);
        }

        for (int i : nums2) {
            nums2Map.putIfAbsent(i, 0);
        }

        int num1 = 0, num2 = 0;
        for (int i : nums1) {
            if(nums2Map.containsKey(i)){
                num1++;
            }
        }
        for (int i : nums2) {
            if(nums1Map.containsKey(i)){
                num2++;
            }
        }
        return new int[]{num1, num2};
    }

}
